package cn.com.corelib;

import android.content.Context;
import android.os.Build;
import android.os.StrictMode;
import android.support.multidex.MultiDex;
import android.support.multidex.MultiDexApplication;

import com.liulishuo.filedownloader.FileDownloader;

import cn.com.corelib.constants.Configuration;
import cn.com.corelib.utils.GalleryFinalConfigurator;
import cn.com.corelib.utils.PreferencesHelper;
import cn.com.corelib.utils.ToastMgr;

/**
 * Created by guoh on 2018/2/9.
 */

public class CoreLibApplicition extends MultiDexApplication{

    @Override
    protected void attachBaseContext(Context base) {
        super.attachBaseContext(base);
        MultiDex.install(this);
    }


    @Override
    public void onCreate() {
        super.onCreate();
        //解决7.0上相机崩溃
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
            StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder();
            StrictMode.setVmPolicy(builder.build());
            builder.detectFileUriExposure();
        }

        ToastMgr.init(getApplicationContext()); //初始化Toast管理器
        Configuration.enableLoggingNetworkParams(); //打开网络请求Log打印
        PreferencesHelper.init(getApplicationContext()); //初始化SharedPreferences工具类
        FileDownloader.setup(getApplicationContext()); //初始化下载工具
        GalleryFinalConfigurator.config(getApplicationContext()); //初始化GalleryFinal
    }
}
